<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

$(function(){
	
	//添加验证
	addValid();
		//保存按钮绑定事件
		$("#saveButton").click(function(){
			if($("#doctargetForm").form('validate')){
				$(this).attr("disabled",true);
				$.ajax({
					   type: "POST",
					   url: "<c:url value='/docTargetUnitManager/save' />",
					   data: $('#doctargetForm').serialize(),
					   success: function(msg){
					    if(msg.state=="200"){
					    	 parent.closeDialog();
					    }else{
					    	 $.messager.alert('提示','数据保存失败');
					    	 $(this).attr("disabled",false);
					    }
					   }
					});
			}
		});
	});
	


//添加验证
function addValid(){
	$("#targetUnitName").textbox({
	    required: true,
	    validType:'length[1,200]'
	});
	
	$("#targetType").combobox({
		editable:false, 
		required: true,
		validType: 'selectValueRequired'
	});
}

